<%= error_messages_for :report_template %>
<% form_for :ticket, :url => report_templates_path, :html => {:method => :post} do %>
  <label for="report_template_name">Name:</label>
  <%= text_field 'report_template', 'name'  %><br />
  <label for="report_template_tickets_status">Tickets status: </label>
  <%=  select "report_template", "tickets_status",  %w[all open closed]  %><br />
  <label for="report_template_ticket_template"> Ticket template:</label>
  <%= select("report_template", "ticket_template_id", @ticket_templates.collect {|p| [ p.name, p.id ] })%>
  <%= observe_field :report_template_ticket_template_id, :url => { :action => :update_note_types_fields },
      :update => :note_types_fields,
      :with => 'report_template[ticket_template_id]'
      %>
  <br />
  <label for="report_template_order"> Order by:</label>
  <%= select("report_template", "order", ["created_at", "updated_at", "deadline", "created_at DESC", "updated_at DESC", "deadline DESC"])%>
  <br />
   <%= render :partial => "main_fields_form" %>
   <div id="note_types_fields">
    <%= render :partial => "note_types_fields" %>
   </div>
   <%= add_search_field_link "Add new condition" %>
<div id="search_fields">
 <% @report_template.conditions.each do |condition| %>
     <%= render :partial => "search_field" %>
  <% end %>
</div>
  
  <%= submit_tag "Create" %>
<% end %>
</p>

